package cn.tedu.reflection;

import java.util.Arrays;
import java.util.Locale;

public class ReciewString {
    public static void main(String[] args) {
        String s="abc";
        char[] value={'a','b','c'};
        String ss=new String(value);

        
        System.out.println(s.hashCode());
        System.out.println(s.toString());
        System.out.println(ss.hashCode());
        System.out.println(s.equals(ss));
        System.out.println(s.length());
        System.out.println(s.toUpperCase(Locale.ROOT));
        System.out.println(s.toLowerCase(Locale.ROOT));
        System.out.println(s.startsWith("a"));
        System.out.println(s.endsWith("a"));
        System.out.println(s.charAt(2));
        System.out.println(s.concat("cxt"));//abccxt
        System.out.println(s);//abc,拼接字符串不会影响原串

        ss="abcdcc";
        System.out.println(ss.indexOf("c"));//2
        System.out.println(ss.lastIndexOf("c"));//5
        ss ="a,b,c,d,e,f";
        System.out.println(ss.split(","));
        System.out.println(Arrays.toString(ss.split(",")));
        
        ss="    abc    ";
        System.out.println(ss.trim());

        ss="avcdefghi";
        System.out.println(ss.substring(3));//defghi
        System.out.println(ss.substring(3,6));//def

        byte[] bytes = ss.getBytes();//alt+Enter自动提示返回值类型+引用类型变量名
        System.out.println(String.valueOf(10)+10);//1010
        System.out.println(20+10);//30
        System.out.println("*************************");
        String s2="a,b,c,d,e";
        System.out.println(Arrays.toString(s2.split(",")));
        String[] a=s2.split(",");
        for (int i = 0; i < a.length; i++) {
            System.out.println(a[i]);
        }
        System.out.println("*************************");
        String s3="111";
        System.out.println(Arrays.toString(s3.split("1")));
        String[] a1=s3.split(",");
        for (int i = 0; i < a1.length; i++) {
            System.out.println(a1[i]);
        }

    }
}
